home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / rapi.e < prev    next >
Text File  |  1992-08-18  |  1KB  |  25 lines

  1. /* An example of usage of random numbers in E to show pattern in algorithym
  2. probobaly not the best code.  Just cause this is my first attempt at programing
  3. in E. */
  4.  
  5. DEF w,randuma,i,randumb,randumc  /* declaration of varibles used */
  6.  
  7. PROC main()
  8.    IF w:=OpenW(20,11,400,100,$200,$f,'RAPI © 1993 Bryce Bockman',NIL,1,NIL)   /* Opens window to be used */
  9.       FOR i:= 0 TO 10000         /* start loop here */
  10.          mylabel:                /* loop reference */
  11.          randuma:=Rnd(379)       /* gets random number to plot the x cord.  379 is max x cord of the window to be written to */
  12.          randumb:=Rnd(98)        /* gets random number for y cord. */
  13.          randumc:=Rnd(4)         /* gets randum color of pixel from 4 */
  14.          IF randumb<11 THEN JUMP mylabel      /* makes sure that */ 
  15.          IF randuma<6 THEN JUMP mylabel      /* the borders arent drawn to*/
  16.          Plot(randuma,randumb,randumc)  /*plots point at random x,y,color*/
  17.       ENDFOR                    /* end of for loop */
  18.       WaitIMessage(w)           /* waits for user input close gadget */
  19.       CloseW(w)                 /* closes window */
  20.    ENDIF                        /* end of If block */
  21. ENDPROC                         /* end of main function */
  22.  
  23. /* Bryce Bockman 1:350/32.2 */
  24.  
  25.